@ECHO OFF
SET PATH=%PATH%;D:\Develop\Libraries\protobuf-3.6.1-build\Release

RMDIR /S /Q out\cpp
RMDIR /S /Q out\java

MKDIR out\cpp
MKDIR out\cpp\urk_pb
MKDIR out\cpp\include\urk_pb
MKDIR out\java

COPY CMakeLists.txt.edit out\cpp\CMakeLists.txt

CLS

ECHO Processing... 

CALL process.bat Authentication.proto
CALL process.bat Chat.proto
CALL process.bat DataTypes.proto
CALL process.bat Entity.proto
CALL process.bat GUI.proto
CALL process.bat Handshake.proto
CALL process.bat Initial.proto
CALL process.bat Inventory.proto
CALL process.bat Map.proto
CALL process.bat Metadata.proto
CALL process.bat Movement.proto


ECHO Configuring and compiling...
CD out\cpp
cmake -G "Visual Studio 15 2017 Win64"

set VCVARS="D:\Programs\VS2017Enterprise\VC\Auxiliary\Build\vcvarsall.bat"
set DEVENV="D:\Programs\VS2017Enterprise\Common7\IDE\devenv.exe"

call %VCVARS% x86_amd64
%DEVENV% urk_pb.sln /rebuild "Release|x64" /out build.log
TYPE build.log

ECHO Creating includes... 
XCOPY /S urk_pb\*.pb.h include\urk_pb

CD ..\..

ECHO Finished! 
PAUSE > nul
START out\cpp
